#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main()
{
    string s("abcd12345ed125ss123058789");
    //cin >> s;
    int ret = 0;
    pair<int, int> index;
    for (int i = 0; i < s.size(); i++)
    {
        int j = i;
        if (s[i] == '1')
        {
            int x = 0;
        }
        while (j < s.size() && (s[j] >= '0' && s[j] <= '9'))
        {
            j++;
        }
        if (ret < j - i)
        {
            ret = j - i + 1;
            index.first = i;
            index.second = j;
        }
        i = j;

    }
    string res;
    for (int i = index.first; i <= index.second; i++)
    {
        res += s[i];
    }
    cout << res << endl;
    return 0;
}


class Solution {
public:
    typedef pair<int, int> PII;
    int dx[4] = { 0, 0, 1, -1 };
    int dy[4] = { 1, -1, 0, 0 };
    int m, n;
    bool vis[201][201] = { 0 };
    int solve(vector<vector<char> >& grid) {
        m = grid.size();
        n = grid[0].size();
        int cnt = 0;
        for (int i = 0; i < m; i++)
        {
            for (int j = 0; j < n; j++)
            {
                if (grid[i][j] == '1' && vis[i][j] == false)
                {
                    cnt++;
                    cout << i << " " << j << endl;
                    queue<PII> q;
                    q.push({ i, j });
                    vis[i][j] = true;
                    while (q.size())
                    {
                        PII t = q.front(); q.pop();
                        int a = t.first; int b = t.second;
                        for (int k = 0; k < 4; k++)
                        {
                            int x = a + dx[k]; int y = b + dy[k];
                            if (x >= 0 && x < m && y >= 0 && y < n
                                && vis[x][y] == false && grid[x][y] == '1')
                            {
                                vis[x][y] = true;
                                q.push({ x, y });
                            }
                        }
                    }
                }
            }
        }
        return cnt;
    }
};


